<?php

/**
 * Rounds filter form base class.
 *
 * @package    gamerstats
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseRoundsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'redscore'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'bluescore'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'map'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Maps'), 'add_empty' => true)),
      'screen'      => new sfWidgetFormFilterInput(),
      'war'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Wars'), 'add_empty' => true)),
      'description' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'redscore'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'bluescore'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'map'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Maps'), 'column' => 'idmaps')),
      'screen'      => new sfValidatorPass(array('required' => false)),
      'war'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Wars'), 'column' => 'idwars')),
      'description' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('rounds_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Rounds';
  }

  public function getFields()
  {
    return array(
      'idrounds'    => 'Number',
      'redscore'    => 'Number',
      'bluescore'   => 'Number',
      'map'         => 'ForeignKey',
      'screen'      => 'Text',
      'war'         => 'ForeignKey',
      'description' => 'Text',
    );
  }
}
